//
//  LMFinanceEnum.m
//  WelfareManager
//
//  Created by longmin on 17/3/28.
//  Copyright © 2017年 timtian. All rights reserved.
//

#import "LMFinanceEnum.h"

@implementation LMFinanceEnum

static LMFinanceEnum * instance;

+ (id)allocWithZone:(struct _NSZone *)zone
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [super allocWithZone:zone];
    });
    return instance;
}

+ (instancetype)financeEnum {
    if (instance == nil) {
        instance = [[LMFinanceEnum alloc] init];
    }
    return instance;
}

- (NSArray *)financeTypes {
    if (_financeTypes == nil) {
        NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"FinanceType" ofType:@"plist"];
        _financeTypes = [[NSArray alloc] initWithContentsOfFile:plistPath];
        NSLog(@"%@",self.financeTypes);
    }
    return _financeTypes;
}

- (NSString *)financeType:(LMFinanceType)type {
    return self.financeTypes[type];
}

- (NSArray *)financeTimes {
    if (_financeTimes == nil) {
        NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"FinanceTime" ofType:@"plist"];
        _financeTimes = [[NSArray alloc] initWithContentsOfFile:plistPath];
        NSLog(@"%@",self.financeTimes);
    }
    return _financeTimes;
}

- (NSString *)financeTime:(LMFinanceTime)time {
    return self.financeTimes[time];
}

- (NSArray *)accountTypes {
    if (_accountTypes == nil) {
        NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"AccountType" ofType:@"plist"];
        _accountTypes = [[NSArray alloc] initWithContentsOfFile:plistPath];
        NSLog(@"%@",self.accountTypes);
    }
    return _accountTypes;
}

- (NSString *)accountType:(LMAccountType)type {
    return self.accountTypes[type];
}


- (NSArray *)storeListTypes {
    if (_storeListTypes == nil) {
        NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"StoreType" ofType:@"plist"];
        _storeListTypes = [[NSArray alloc] initWithContentsOfFile:plistPath];
        NSLog(@"%@",self.storeListTypes);
    }
    return _storeListTypes;
}

- (NSString *)storeListType:(StoreListType)type {
    return self.storeListTypes[type];
}


- (NSArray *)withdrawStates {
    if (_withdrawStates == nil) {
        NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"WithdrawState" ofType:@"plist"];
        _withdrawStates = [[NSArray alloc] initWithContentsOfFile:plistPath];
        NSLog(@"%@",self.withdrawStates);
    }
    return _withdrawStates;
}

- (NSString *)withdrawStates:(LMWithdrawState)state {
    return self.withdrawStates[state];
}

- (NSArray *)storeFinanceTypes {
    if (_storeFinanceTypes == nil) {
        NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"StoreFinanceType" ofType:@"plist"];
        _storeFinanceTypes = [[NSArray alloc] initWithContentsOfFile:plistPath];
        NSLog(@"%@",self.storeFinanceTypes);
    }
    return _storeFinanceTypes;
}

- (NSString *)storeFinanceType:(LMStoreFinanceType)type {
    return self.storeFinanceTypes[type];
}

@end
